/**
 * 供应商列表
 * Created by wujianjin on 2015/7/16.
 */


define(function (require, exports, module) {
    'use strict';
    module.exports = function (app) {
        app.register.controller('supplier-list', ['$scope', 'MHService', '$location',function ($scope, MHService,$location) {


            var feed = MHService.globalData(false, {key: 'feed'});
            $scope.title = feed[1];
            console.log("14",feed);
            var getUrl = MHService.URL.supplier_list + "?id=" + feed[0];
            MHService.getReq({url:getUrl}, function (data) {
//                console.log("14",data);
                if(data){
                    $scope.suppliers = data.datas;
                    MHService.globalData(true, {key: 'auths',value:data.auths});
                    console.log("14",$scope.suppliers);
                }else{
                    MHService.Toast('获取供应商列表失败');
                }

            });

            $scope.materialDetails = function(s){
                MHService.globalData(true, {key: 'detail',value:s});
                $location.path("/materialDetails");
            };

            $scope.materialAdd = function(s){
                MHService.globalData(true, {key: 'supplier',value:s});
                $location.path("/material/add");
            };
            var isShow = true;
            MHService.globalData(true, {key: 'isShow', value : isShow});
        }]);
    };
});

